#include "unistd.h"
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>

int main(int argc, char *argv[])
{
    pid_t pid;
    int a = 0;
    printf("now pid = %d\n", getpid());

    if ( (pid = fork() ) < 0)
    {
        printf("fork error");
    }
    else if (pid == 0)
    {
#if 1
        /* specify pathname, specify environment */
        if (execl("/usr/local/bin/busybox", "mount ota.img /media/usb -t squashfs -o loop",  (char *)0) < 0)
            printf("execl error");
#endif
    }

    printf("pid = %d\n", pid);
    if (waitpid(pid, NULL, 0) < 0){
        printf("error getpid = %d\n", getpid());
        printf("wait pid %d error\n", pid);
    }
    printf("pid = %d\n", pid);

    return 0;
}

